import React, { Component } from 'react'
import Item from './components/Item'
import top from './models/top'
import style from './App.module.css'
export default class App extends Component {
  constructor(props){
    super(props);
    this.state = {
      value:[]
    }
  };
  async componentDidMount(){
    var data = await top();
    this.setState({
      value:data.data.playlists
    })
    console.log(this.state.value);
  }
  render() {
    const itemList = this.state.value.map((res,index)=>{
      return (<Item key={index} value={res}></Item>)
    })
    console.log(itemList);
    return (
      <div  className={style.app}>
        <h1>hello world</h1>
        <div className={style.itemBody}>{itemList}</div>
      </div>
    )
  }
}
